unit frmFirmStructTree;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 
  Dialogs, cxGraphics, cxControls, cxLookAndFeels, cxLookAndFeelPainters,
  cxContainer, cxEdit, dxSkinsCore, dxSkinOffice2007Black, cxCustomData,
  cxStyles, cxTL, cxMaskEdit, cxTLdxBarBuiltInMenu, AdvGlowButton, cxLabel,
  cxInplaceContainer, cxDBTL, cxTLData, cxGroupBox, ImgList, Menus,
  AdvMenus, AdvMenuStylers, ActnList, DB, MemDS, DBAccess, Uni, DM;

type
  TFirmStructTreeFrame = class(TFrame)
    quDepartment: TUniQuery;
    ActionList: TActionList;
    actAddOffice: TAction;
    actAddChildOffice: TAction;
    actEditOffice: TAction;
    actDelOffice: TAction;
    actRefreshOffice: TAction;
    AdvMenuOfficeStyler1: TAdvMenuOfficeStyler;
    pmOffice: TAdvPopupMenu;
    actAddOffice1: TMenuItem;
    N2: TMenuItem;
    actEditOffice1: TMenuItem;
    actDelOffice1: TMenuItem;
    N1: TMenuItem;
    actRefreshOffice1: TMenuItem;
    ilOffice: TcxImageList;
    pnlDep: TcxGroupBox;
    tvDepartment: TcxDBTreeList;
    colOfTitle: TcxDBTreeListColumn;
    colAddress: TcxDBTreeListColumn;
    lblToolbar: TcxLabel;
    AdvGlowButton1: TAdvGlowButton;
    dsDepartment: TUniDataSource;
    procedure actEditOfficeExecute(Sender: TObject);
    procedure tvDepartmentDblClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    constructor Create(AOwner: TComponent); override;
  end;

implementation

uses
  fmOfficeEdit;

{$R *.dfm}

{ TFirmStructTreeFrame }

constructor TFirmStructTreeFrame.Create(AOwner: TComponent);
begin
  inherited;
  quDepartment.Open;
  quDepartment.Locate('type_id', 6, []);
end;

procedure TFirmStructTreeFrame.actEditOfficeExecute(Sender: TObject);
begin
  if TOfficeEditForm.Execute(self, dsDepartment) then
    actRefreshOffice.Execute;
end;

procedure TFirmStructTreeFrame.tvDepartmentDblClick(Sender: TObject);
begin
  actEditOffice.Execute;
end;

end.
